package com.geekaca.d05;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class HelloIterator {
    public static void main(String[] args) {
        /**
         * 遍历迭代器
         */
        List<String> nameList = new ArrayList<>();
        nameList.add("张三丰");
        nameList.add("张无忌");
        nameList.add("小昭");
        Iterator<String> iterator = nameList.iterator();

        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
    }
}
